package compiler

import (
	"context"

	"tvl.fyi/tvix/eval/internal/bytecode"
	"tvl.fyi/tvix/eval/internal/util"
)

type Callable interface {
	Chunk() *bytecode.Chunk
}

// lambda is the internal representation of a compiled Nix function.
type lambda struct {
	noCopy util.NoCopy
	chunk  bytecode.Chunk
} // TODO: name, upvalues, formals

type function struct {
	lambda *lambda
}

func (f function) NixType() string {
	return "lambda"
}

func (f function) String() string {
	return "«lambda»" // TODO
}

func (function) Strict(context.Context) error {
	return nil
}

func (f function) Chunk() *bytecode.Chunk {
	return &f.lambda.chunk
}
